clear all
set more off, perm
set varabbrev off
global dir      "TYPE YOUR PATH HERE"

* APPROACH #1:  Run the do files interactively
* ---------------------------------------------- *
local d "$dir"
* prepare the data
do $dir/PrepareData/link_ibes_crsp2024.do	"`d'"
do $dir/PrepareData/read_crsp.do		"`d'"
do $dir/PrepareData/read_ibes_qtly.do		"`d'"
do $dir/PrepareData/read_ibes.do		"`d'"
do $dir/PrepareData/read_compustat.do		"`d'"
do $dir/PrepareData/read_compustat_qtly.do	"`d'"
do $dir/PrepareData/ibes_ret.do			"`d'"
do $dir/PrepareData/payout.do			"`d'"
do $dir/PrepareData/mktrf.do			"`d'"
do $dir/PrepareData/MOME.do			"`d'"
do $dir/PrepareData/EBR_monthly.do		"`d'"
do $dir/PrepareData/Portfolio01.do		"`d'"
do $dir/PrepareData/FE_Mo_June.do		"`d'"
do $dir/PrepareData/Firms01_June.do		"`d'"
* ---------------------------------------------- *
* Create tables and figures
do $dir/Tables/Table01_02_June.do 	"`d'"
do $dir/Tables/Table03_June.do		"`d'"
do $dir/Tables/Table04_June.do		"`d'"
do $dir/Tables/Table05_06_dp_June.do	"`d'"
do $dir/Tables/Table07_June.do		"`d'"
do $dir/Tables/Table08_dp_June.do	"`d'"
do $dir/Tables/Table09_June.do		"`d'"
do $dir/Tables/Table10_June.do		"`d'"
do $dir/Tables/graphs_June.do		"`d'"
* ---------------------------------------------- *
* Appendices
do $dir/Tables/AppendixA1_June.do  "`d'"
do $dir/Tables/AppendixB1_June.do  "`d'"
do $dir/Tables/AppendixB2_June.do  "`d'"
do $dir/Tables/AppendixB3_June.do  "`d'"
do $dir/Tables/AppendixB4_June.do  "`d'"
do $dir/Tables/AppendixB5_June.do  "`d'"
do $dir/Tables/AppendixB6_June.do  "`d'"
do $dir/Tables/AppendixB7_June.do  "`d'"
do $dir/Tables/AppendixB8_June.do  "`d'"
do $dir/Tables/AppendixB9_June.do  "`d'"
do $dir/Tables/AppendixB10_June.do "`d'"
do $dir/Tables/AppendixB11_June.do "`d'"
do $dir/Tables/AppendixB12_June.do "`d'"
do $dir/Tables/AppendixB13_June.do "`d'"
do $dir/Tables/AppendixC1_June.do  "`d'"
do $dir/Tables/AppendixC2_June.do  "`d'"
do $dir/Tables/AppendixC4_June.do  "`d'"
do $dir/Tables/AppendixC5_June.do  "`d'"
do $dir/Tables/AppendixD1_June.do  "`d'"
do $dir/Tables/AppendixD2_June.do  "`d'"
* ---------------------------------------------- */
* APPROACH #2:  Run the do files in batch mode 
* ---------------------------------------------- *
* Data:
local d "$dir"
foreach name in link_ibes_crsp2024 read_crsp.do read_ibes_qtly read_ibes.do read_compustat.do /* 
*/ 	read_compustat_qtly ibes_ret payout mktrf MOME EBR_monthly Portfolio01 FE_Mo_June Firms01_June {
display "`name'.do"
!/usr/local/stata/stata-mp -b do "`d'"/PrepareData/"`name'.do"  	"`d'" &
}
* Tables:
foreach name in Table01_02 Table03 Table04 Table05_06_dp Table07 Table08_dp Table09 Table10 {
display "`name'_June.do"
!/usr/local/stata/stata-mp -b do "`d'"/Tables/"`name'_June.do"  	"`d'" &
}
* Appendices:
!/usr/local/stata/stata-mp -b do "`d'"/Tables/AppendixA1_June.do 	"`d'" &
*
forvalues x=1(1)13  {
display "AppendixB""`x'""_June.do"
!/usr/local/stata/stata-mp -b do "`d'"/Tables/"AppendixB""`x'""_June.do" "`d'" &
}
*
local d "$dir"
forvalues x=1(1)5  {
display "AppendixC""`x'""_June.do"
!/usr/local/stata/stata-mp -b do "`d'"/Tables/"AppendixC""`x'""_June.do" "`d'" &
}
*
local d "$dir"
forvalues x=1(1)2  {
display "AppendixD""`x'"".do"
!/usr/local/stata/stata-mp -b do "`d'"/Tables/"AppendixD""`x'""_June.do" "`d'" &
}
